<template>
  <el-container>


    <el-main>
      <el-table style="width: 100%" :data="list">
       <el-table-column label="用户" prop="user.nickname">
          <template slot-scope="scope">
            <div v-if="scope.row.user">
              {{scope.row.user.nickname}}
            </div>
          </template>
        </el-table-column>


 <el-table-column label="电话号码" prop="user.phone">
        </el-table-column>

        <el-table-column label="内容" prop="content">
        </el-table-column>

        <el-table-column label="日期" prop="created_at">
        </el-table-column>
      </el-table>
      <el-dialog title="提示" visible.sync="dialogVisible" width="30%">
        <span>是否要核销</span>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisible = false">取 消</el-button>
          <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
        </span>
      </el-dialog>
    </el-main>

    <el-footer>
      <el-pagination background layout="prev, pager, next" :page-size="search_form.num" :total="total" @current-change="current_change">
      </el-pagination>
    </el-footer>
  </el-container>
</template>

<script>
  export default {
    data() {
      return {
        formInline: {
          phone: "",
          price: ""
        },
        state: "",
        data: {},
        onSubmit: false,
        search_form: {
          table: "tree_logs",
          page: 1,
          num: 5,
          where: null,
          orderBy: "id",
          asdes: "asc"
        },
        total: 0,
        list: [],
      }
    },
    mounted() {
      // this.hx()
      this.get_data()
    },
    methods: {

      hx() {
        this.$model.post("/cms/common/hx_red_pakage", this.formInline.phone, this.formInline.price).then(res => {
          if (res.code == 200) {
            this.data = res.data
            console.log("data:", this.data)
          }
        })
      },
      get_data() {
        const loading = this.$loading({
                 lock: true,
                 text: '加载中',
                 spinner: 'el-icon-loading',
                 background: 'rgba(0, 0, 0, 0.7)'
               });
        this.$model.post("/cms/table/get", this.search_form).then(res => {
          if (res.code == 200) {
            loading.close();
            this.list = res.data.data
            this.total = res.data.total
          }
        })
      },
      current_change(e) {
        this.search_form.page = e
        this.get_data()
      }

    }
  }
</script>

<style>
</style>
